//
//  AboatViewController.swift
//  Wmsmobile
//
//  Created by wangshuning on 16/7/28.
//  Copyright © 2016年 hddden. All rights reserved.
//

import UIKit

class AboatViewController: UIViewController {

    var button = UIButton()
    var bview = UIView()
    //#MARK: – Lifecycle
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.hexStringToUIColor("#eeeeee")
        let nav = UINavigationBar.init(frame: CGRect(x: 0, y: 0, width: KscreenWidth, height: 64))
        UINavigationBar.appearance().barTintColor = UIColor.hexStringToUIColor("#00acff")
        
        let lbutton = UIButton.init(frame: CGRect(x: 15, y: 20, width: 44, height: 44))
        lbutton.setImage(UIImage(named: "返回"), forState: UIControlState.Normal)
        //        lbutton.backgroundColor = UIColor.greenColor()
        lbutton.imageView?.contentMode = UIViewContentMode.ScaleAspectFill
        lbutton.addTarget(self, action: #selector(SetViewController.back), forControlEvents: UIControlEvents.TouchUpInside)
        
        let label = UILabel.init(frame: CGRect(x: 50, y: 20, width: KscreenWidth-120, height: 44))
        label.text = "关于"
        //label.backgroundColor = UIColor.redColor()
        label.textAlignment = NSTextAlignment.Center
        label.textColor = UIColor.whiteColor()
        label.font = UIFont.systemFontOfSize(17)
        self.view.addSubview(nav)
        self.view.addSubview(lbutton)
        self.view.addSubview(label)
        self.setUpUI()
        // Do any additional setup after loading the view.
    }
    
    lazy private var imgView: UIImageView = {
        let img = UIImageView()
        img.image = UIImage.init(named: "icon-29@3x")
        img.layer.cornerRadius = 20
        img.clipsToBounds  = true
        img.backgroundColor = UIColor.redColor()
        return img
    }()
    
    lazy private var vLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.hexStringToUIColor("#333333")
        label.text = " 云仓 v1.0.0"
        label.textAlignment = .Center
        label.font = UIFont.systemFontOfSize(14)
        label.numberOfLines = 0
//        label.backgroundColor = UIColor.redColor()
        return label
    }()
    lazy private var uBt: UIButton = {
        let button = UIButton()
        button.layer.borderColor = UIColor.hexStringToUIColor("#cccccc").CGColor
        button.layer.borderWidth = 0.5
        button.backgroundColor = UIColor.whiteColor()
        button.setBackgroundImage(UIImage(named: " "), forState: UIControlState.Normal)
        button.setBackgroundImage(UIImage(named: "CCCCCC"), forState: UIControlState.Highlighted)
        button.addTarget(self, action: #selector(AboatViewController.feedAction), forControlEvents: UIControlEvents.TouchUpInside)
        return button
    }()
    lazy private var tBt: UIButton = {
        let button = UIButton()
        button.layer.borderColor = UIColor.hexStringToUIColor("#cccccc").CGColor
        button.layer.borderWidth = 1
        button.backgroundColor = UIColor.whiteColor()
        button.setBackgroundImage(UIImage(named: "  "), forState: UIControlState.Normal)
        button.setBackgroundImage(UIImage(named: "CCCCCC"), forState: UIControlState.Highlighted)
        button.addTarget(self, action: #selector(AboatViewController.feedAction), forControlEvents: UIControlEvents.TouchUpInside)
        return button
    }()
    
    lazy private var uLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.hexStringToUIColor("#333333")
        label.text = "版本更新"
        label.font = UIFont.systemFontOfSize(14)
        label.numberOfLines = 0
//        label.backgroundColor = UIColor.greenColor()
        return label
    }()
    
    
    lazy private var tLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.hexStringToUIColor("#333333")
        label.text = "已经是最新版本 v1.0.0"
        label.font = UIFont.systemFontOfSize(12)
        label.textAlignment = .Right
        label.numberOfLines = 0
//        label.backgroundColor = UIColor.greenColor()
        return label
    }()
    lazy private var hLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.hexStringToUIColor("#333333")
        label.font = UIFont.systemFontOfSize(15)
        label.text = "去评分"
        label.numberOfLines = 0
//        label.backgroundColor = UIColor.blueColor()
        return label
    }()
    
    lazy private var rightImg: UIImageView = {
        let img = UIImageView()
        img.image = UIImage.init(named: "箭头icon")
//        img.backgroundColor = UIColor.blueColor()
        return img
    }()
    
    lazy private var userLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.hexStringToUIColor("#00acff")
        label.font = UIFont.systemFontOfSize(13)
        label.textAlignment = .Right
        label.text = "用户协议"
        return label
    }()
    lazy private var lineLabel: UILabel = {
        let label = UILabel()
        label.backgroundColor = UIColor.hexStringToUIColor("#00acff")
        return label
    }()
    lazy private var rLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.hexStringToUIColor("#00acff")
        label.font = UIFont.systemFontOfSize(13)
        label.text = "知识产权"
        return label
    }()
    
    
    lazy private var desLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.hexStringToUIColor("#333333")
        label.font = UIFont.systemFontOfSize(12)
        label.text = "上海海鼎信息工程股份有限公司"
        label.textAlignment = .Center
//        label.backgroundColor = UIColor.redColor()
        return label
    }()
    
    lazy private var eLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.hexStringToUIColor("#333333")
        label.font = UIFont.systemFontOfSize(12)
        label.text = "HEADING INFORMAION ALL RIGHTS RESERVED"
        label.textAlignment = .Center
//        label.backgroundColor = UIColor.redColor()
        return label
    }()
    
    func feedAction() {
    }
    
    func setUpUI(){
        //        self.textLabel?.adjustsFontSizeToFitWidth = true
        self.view.addSubview(self.imgView)
        self.view.addSubview(self.vLabel)
        self.view.addSubview(self.uBt)
        self.view.addSubview(self.tBt)
        self.view.addSubview(self.userLabel)
        self.view.addSubview(self.eLabel)
        self.view.addSubview(self.desLabel)
        self.view.addSubview(self.rLabel)
        self.view.addSubview(self.lineLabel)
        self.uBt.addSubview(self.uLabel)
        self.uBt.addSubview(self.tLabel)
        self.tBt.addSubview(self.hLabel)
        self.tBt.addSubview(self.rightImg)
        imgView.snp_makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.centerY.equalTo(self.view).offset(-120)
            make.width.equalTo(80)
            make.height.equalTo(80)
        }
        
        vLabel.snp_makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.centerY.equalTo(self.view).offset(-65)
            make.width.equalTo(KscreenWidth)
            make.height.equalTo(25)
        }
        uBt.snp_makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.bottom.equalTo(self.view).offset(-215)
            make.width.equalTo(KscreenWidth+2)
            make.height.equalTo(44)
        }
        uLabel.snp_makeConstraints { (make) in
            make.leading.equalTo(self.uBt).offset(15)
            make.centerY.equalTo(self.uBt)
            make.width.equalTo(100)
            make.height.equalTo(25)
        }
        
        tLabel.snp_makeConstraints { (make) in
            make.trailing.equalTo(self.uBt).offset(-15)
            make.centerY.equalTo(self.uBt)
            make.width.equalTo(150)
            make.height.equalTo(25)
        }
        tBt.snp_makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.bottom.equalTo(self.view).offset(-172)
            make.width.equalTo(KscreenWidth+2)
            make.height.equalTo(44)
        }
        
        hLabel.snp_makeConstraints { (make) in
            make.leading.equalTo(self.tBt).offset(15)
            make.centerY.equalTo(self.tBt)
            make.width.equalTo(100)
            make.height.equalTo(25)
        }
        
        rightImg.snp_makeConstraints { (make) in
            make.trailing.equalTo(self.tBt).offset(-15)
            make.centerY.equalTo(self.tBt)
            make.width.equalTo(25)
            make.height.equalTo(25)
        }
        
        
        userLabel.snp_makeConstraints { (make) in
            make.centerX.equalTo(self.view).offset(-45)
            make.bottom.equalTo(self.view).offset(-86)
            make.width.equalTo(80)
            make.height.equalTo(25)
        }
        
        lineLabel.snp_makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.bottom.equalTo(self.view).offset(-91)
            make.width.equalTo(1)
            make.height.equalTo(13)
        }
        
        rLabel.snp_makeConstraints { (make) in
            make.centerX.equalTo(self.view).offset(45)
            make.bottom.equalTo(self.view).offset(-86)
            make.width.equalTo(80)
            make.height.equalTo(25)
        }
        
        desLabel.snp_makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.bottom.equalTo(self.view).offset(-45)
            make.width.equalTo(KscreenWidth)
            make.height.equalTo(25)
        }
        
        eLabel.snp_makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.bottom.equalTo(self.view).offset(-20)
            make.width.equalTo(KscreenWidth)
            make.height.equalTo(25)
        }
    }
    
    func back() {
        // let  setVC = SetViewController()
        // self.navigationController?.pushViewController(setVC, animated: true)
        self.navigationController?.popViewControllerAnimated(true)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
